﻿using System.Collections.Generic;
using Newtonsoft.Json;

namespace T.FAS.Runtime.Metadata.Entity.MF
{
    public class ActionNode : NodeBase
    {
        [JsonProperty("data")]
        public new ActionNodeData Data { get; set; }
        [JsonIgnore]
        public override string RefMetaDataID
        {
            get
            {
                return Data.ActionID;
            }
        }
        [JsonIgnore]
        public override string RefMetaDataType
        {
            get
            {
                return "action";
            }
        }
    }
      
    public class ActionNodeData
    {
        [JsonProperty("label")]
        public string Label { get; set; }

        [JsonProperty("description")]
        public string Description { get; set; }

        [JsonProperty("actionId")]
        public string ActionID { get; set; }
        [JsonProperty("actionName")]
        public string ActionName { get; set; }
        [JsonProperty("actionCode")]
        public string ActionCode { get; set; }
        [JsonProperty("parameterValues")]
        public List<ActionParameterNode> ParameterValues { get; set; }

        [JsonProperty("outputFields")]
        public List<ActionOutputField> OutputVariables { get; set; }
        [JsonProperty("error_strategy")]
        public string ErrorStrategy { get; set; }

        [JsonProperty("default_value")]
        public List<UserVariable> DefaultValues { get; set; }

    }

    public class ActionParameterNode
    {
        [JsonProperty("ID")]
        public string ID { get; set; }
        [JsonProperty("ActionMetaDataID")]
        public string ActionMetaDataID { get; set; }
        [JsonProperty("Code")]
        public string Code { get; set; }

        [JsonProperty("Name")]
        public string Name { get; set; }
        [JsonProperty("SortOrder")]
        public int SortOrder { get; set; }
        [JsonProperty("ParamType")]
        public int ParamType { get; set; }
        [JsonProperty("ParamSourceType")]
        public int ParamSourceType { get; set; }

        [JsonProperty("IsAllowNull")]
        public bool IsAllowNull { get; set; }
        [JsonProperty("IsList")]
        public bool IsList { get; set; }
        [JsonProperty("DefaultValue")]
        public string DefaultValue { get; set; }
        [JsonProperty("ParamValue")]
        public object ParamValue { get; set; }
        [JsonProperty("IsSysDefault")]
        public bool IsSysDefault { get; set; }
        [JsonProperty("IsDynamic")]
        public bool IsDynamic { get; set; }
        [JsonProperty("SysDataType")]
        public bool SysDataType { get; set; }
        [JsonProperty("assignment")]
        public AssignmentNode Assignment { get; set; }

    }
    public class ActionOutputField
    {
        [JsonProperty("variableId")]
        public string VariableId { get; set; }
        [JsonProperty("variable")]
        public string Variable { get; set; }

        [JsonProperty("record_category")]
        public string RecordCategory { get; set; }

        [JsonProperty("type")]
        public string Type { get; set; }
    }
}
